tools/oxenstored: Set uncaught exception handler
authorEdwin Török <edvin.torok@citrix.com>
Mon, 7 Nov 2022 17:41:36 +0000 (17:41 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 20 Dec 2022 13:13:40 +0000 (13:13 +0000)
commite13a9a2146952859c21c0a0c7b8b07757c2aba9d
tree95b9d840a3d674336d93b26f958914e836e07482
parent991b512f5f69dde3c923804f887be9df56b03a74
tools/oxenstored: Set uncaught exception handler

Unhandled exceptions go to stderr by default, but this doesn't typically work
for oxenstored because:
 * daemonize reopens stderr as /dev/null
 * systemd redirects stderr to /dev/null too

Debugging an unhandled exception requires reproducing the issue locally when
using --no-fork, and is not conducive to figuring out what went wrong on a
remote system.

Install a custom handler which also tries to render the backtrace to the
configured syslog facility, and DAEMON|ERR otherwise.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
(cherry picked from commit ee7815f49faf743e960dac9e72809eb66393bc6d)
tools/ocaml/xenstored/logging.ml
tools/ocaml/xenstored/xenstored.ml